#ifndef TLS_FILM_H
#define TLS_FILM_H

#include <png.h>
#include <cstdio>
#include <cstdlib>
#include "vector.h"

namespace tls{

  struct film{
    vec3* f;
    int width,height;
    png_bytep* image;

    film(int w,int h):width(w),height(h){
      f=(vec3*)std::malloc(sizeof(vec3) * width * height);
    }
    ~film(){
      std::free(f);
      for(int i=0;i<height;++i) std::free(image[i]);
      std::free(image);
    }

    void process();
    void write(const char* filename) const;
  };
}//namespace tls

#endif
